<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<div id="div1" style="width: 100px;height: 100px; background-color: aquamarine;">div1</div>
		<div id="div2" style="width: 100px;height: 100px; background-color: bisque;">div2</div>
		<div id="div3" style="width: 100px;height: 100px; background-color: cadetblue;">div3</div>
		<h3 id="h3_1">标题1</h3>
		<h3 id="h3_2">标题2</h3>
		<h3 id="h3_3">标题3</h3>
		<p id="p1">p1</p>
		<p id="p2">p2</p>
		<p id="p3">p3</p>
		<p id="p4">p4</p>
		<p id="p5">p5</p>
		<img id="img1" src="杰瑞.jpeg" width="50px">
		<ul id="ul1">
			<li id="li1">列表1</li>
		</ul>
		<button type="button" onclick="idGet()">id查找</button>
		<button type="button" onclick="classnameGet()">classname查找</button>
		<button type="button" onclick="tagnameGrt()">tag查找</button>
	</body>
	<script type="text/javascript">
		function idGet(){
			var text1=document.getElementById('div1');
			console.log(text1);
			var text1=document.getElementById('div2');
			console.log(text1);
			var text1=document.getElementById('div3');
			console.log(text1);
			var text1=document.getElementById('h3_1');
			console.log(text1);
			var text1=document.getElementById('h3_2');
			console.log(text1);
			var text1=document.getElementById('h3_3');
			console.log(text1);
			var text1=document.getElementById('p1');
			console.log(text1);
			var text1=document.getElementById('p2');
			console.log(text1);
			var text1=document.getElementById('p3');
			console.log(text1);
			var text1=document.getElementById('p4');
			console.log(text1);
			var text1=document.getElementById('p5');
			console.log(text1);
			var text1=document.getElementById('img1');
			console.log(text1);
			var text1=document.getElementById('ul1');
			console.log(text1);
			var text1=document.getElementById('li1');
			console.log(text1);
		};
		function classnameGet(){
			var text2=document.getElementsByClassName('div1');
			console.log(text2);
		};
		function tagnameGrt(){
			var text3=document.getElementsByTagName('div');
			console.log(text3);
			var text3=document.getElementsByTagName('h3');
			console.log(text3);
			var text3=document.getElementsByTagName('p');
			console.log(text3);
			var text3=document.getElementsByTagName('img');
			console.log(text3);
			var text3=document.getElementsByTagName('ul');
			console.log(text3);
		}
	</script>
</html>
